#include<iostream>
#include<vector>
#include<cstdio>
#include<algorithm>
using namespace std;

int findPosition(const vector<int>& vec,int a){
    for(int i=0;i<vec.size();i++){
        if(vec[i]==a)
            return i;
    }
    return -1;
}

int main(){
    int m,n;
    while(scanf("%d%d",&m,&n)!=EOF){
        int f = m%n; // 剩下的余数
        vector<int> right,left;
        int tmp=f*10,position=-1;
        left.push_back(f);
        while(tmp != 0){
            right.push_back(tmp/n);
            int index = findPosition(left,tmp%n);
            if(index!=-1){
                position = index;
                break;
            }
            left.push_back(tmp%n);
            tmp %= n;
            tmp *= 10;
        }
        cout<<m<<"/"<<n<<" = "<<m/n<<".";
        // 整除的情况
        if(tmp == 0){
            for(int i=0;i<right.size();i++)
                cout<<right[i];
            cout<<"(0)\n   1 = number of digits in repeating cycle\n\n";
        }
        else{
            int len = right.size()>50 ? 50 : right.size();
            for(int i=0;i<len;i++){
                if(i==position)
                    cout<<"(";
                cout<<right[i];
            }
            if(len == 50)
                cout<<"...)";
            else
                cout<<")";
            cout<<"\n   "<<right.size()-position<<" = number of digits in repeating cycle\n\n";    
        }
    }

    return 0;
}